#!/bin/sh

# color definitions
GREEN="\033[1;92m"
RED="\033[1;91m"
RESET="\033[0m"

# test script for Sokoban project

echo Testing Sokoban solver.

echo Cleaning from previous builds
#make clean

echo Building sokoban
make

echo Running all 5 trivial boards
for i in `seq 5`;
do
  ./sokoban 130.237.218.85 7778 $i

  if [ $? == 0 ]
  then
    echo -e $GREEN Trivial board $i passed.
  else
    echo -e "$RED" Trivial board $i FAILED !
    exit -1
    echo -e "$RESET"
  fi
echo -e "$RESET"
done

echo Running 1st of non-trivial boards
for i in `seq 1`;
do
  ./sokoban 130.237.218.85 7777 $i
  if [ $? == 0 ]
  then
    echo -e "$GREEN" Non trivial board $i passed.
  else
    echo -e "$RED" Non trivial board $i FAILED !
    exit -1
    echo -e "$RESET"
  fi
echo -e "$RESET"
done

